package com.esfak47.mediafetcher.app.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.List;

/**
 * @author tony
 * @date 2018/5/6
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "media", type = "media")
public class MediaEs implements Serializable {

    @Id
    private String id;

    @Field(type = FieldType.Object)
    private List<String> tags;

    @Field(type = FieldType.String)
    private String url;

    @Field(type = FieldType.String)
    private String title;

    @Field(
        type = FieldType.String,
        index = FieldIndex.analyzed,
        searchAnalyzer = "standard",
        store = true
    )
    private String thumbnail;

    @Field(type = FieldType.Object)
    private List<String> categories;
    @Field(type = FieldType.Boolean, store = true)
    private Boolean hd;

    @Field(type = FieldType.Integer, store = true)
    private Integer duration;

    @Field(
        type = FieldType.String,
        index = FieldIndex.analyzed,
        searchAnalyzer = "standard",
        store = true
    )
    private String webpageUrl;

    @Field(type = FieldType.String,
        index = FieldIndex.not_analyzed,
        store = true
    )
    private String fullTitle;
    @Field(type = FieldType.Long, store = true)
    private Integer formatId;
    @Field(type = FieldType.Integer, store = true)

    private Integer commentCount;

    @Field(type = FieldType.Object)
    private List<String> thumbnails;

    @Field(type = FieldType.String, store = true, index = FieldIndex.analyzed)
    private String ext;

    @Field(type = FieldType.String, store = true, index = FieldIndex.analyzed)
    private String extractorKey;

    @Field(type = FieldType.Long, store = true)
    private Integer viewCount;
    @Field(type = FieldType.Long, store = true)
    private Integer rating;
    @Field(type = FieldType.String, store = true, index = FieldIndex.not_analyzed)
    private String fileName;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public List<String> getCategories() {
        return categories;
    }

    public void setCategories(List<String> categories) {
        this.categories = categories;
    }

    public Boolean getHd() {
        return hd;
    }

    public void setHd(Boolean hd) {
        this.hd = hd;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public String getWebpageUrl() {
        return webpageUrl;
    }

    public void setWebpageUrl(String webpageUrl) {
        this.webpageUrl = webpageUrl;
    }

    public String getFullTitle() {
        return fullTitle;
    }

    public void setFullTitle(String fullTitle) {
        this.fullTitle = fullTitle;
    }

    public Integer getFormatId() {
        return formatId;
    }

    public void setFormatId(Integer formatId) {
        this.formatId = formatId;
    }

    public Integer getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Integer commentCount) {
        this.commentCount = commentCount;
    }

    public List<String> getThumbnails() {
        return thumbnails;
    }

    public void setThumbnails(List<String> thumbnails) {
        this.thumbnails = thumbnails;
    }

    public String getExt() {
        return ext;
    }

    public void setExt(String ext) {
        this.ext = ext;
    }

    public String getExtractorKey() {
        return extractorKey;
    }

    public void setExtractorKey(String extractorKey) {
        this.extractorKey = extractorKey;
    }

    public Integer getViewCount() {
        return viewCount;
    }

    public void setViewCount(Integer viewCount) {
        this.viewCount = viewCount;
    }

    public Integer getRating() {
        return rating;
    }

    public void setRating(Integer rating) {
        this.rating = rating;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
}